home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 14 / CU Amiga Magazine's Super CD-ROM 14 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-09].iso / CUCD / Programming / GMS / Source / Asm / Rasterlists / AGAFloodFill.s next >
Encoding:
Text File  |  1997-05-01  |  3.7 KB  |  156 lines

  1. ;-------T-------T------------------------T----------------------------------;
  2. ;AGA FloodFill Demo
  3. ;------------------
  4. ;A demo of how you should use the FLOOD raster command.
  5. ;
  6. ;To exit the demo, press the left mouse button.
  7.  
  8.     INCDIR    "INCLUDES:"
  9.     INCLUDE    "games/games_lib.i"
  10.     INCLUDE    "games/games.i"
  11.  
  12. CALL    MACRO
  13.     jsr    _LVO\1(a6)
  14.     ENDM
  15.  
  16.     SECTION    "FloodFill",CODE
  17.  
  18. ;===========================================================================;
  19. ;                             INITIALISE DEMO
  20. ;===========================================================================;
  21.  
  22.     STARTGMS
  23.  
  24. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  25.     move.l    GMSBase(pc),a6
  26.     lea    ScreenTags(pc),a0
  27.     CALL    AddScreen
  28.     tst.l    d0
  29.     beq.s    .Error_Screen
  30.  
  31.     move.l    Screen(pc),a0
  32.     move.l    GS_MemPtr1(a0),a1
  33.     lea    PicFile(pc),a0
  34.     moveq    #$00,d0
  35.     CALL    SmartLoad
  36.     tst.l    d0
  37.     beq.s    .ReturnToDOS
  38.  
  39.     move.l    Screen(pc),a0
  40.     CALL    ShowScreen
  41.  
  42.     bsr.s    Main
  43.  
  44. .ReturnToDOS
  45.     move.l    GMSBase(pc),a6
  46.     move.l    Screen(pc),a0
  47.     CALL    DeleteScreen
  48. .Error_Screen
  49.     MOVEM.L    (SP)+,A0-A6/D1-D7
  50.     moveq    #ERR_OK,d0
  51.     rts
  52.  
  53. ;===========================================================================;
  54. ;                                MAIN CODE
  55. ;===========================================================================;
  56.  
  57. Main:    move.l    Screen(pc),a0
  58. .Flood    CALL    WaitVBL
  59.     bsr.s    FloodFill
  60.     tst.w    d0
  61.     beq.s    .Flood
  62.  
  63.     CALL    WaitLMB
  64.  
  65.     moveq    #0,d0
  66.     moveq    #2,d1
  67.     lea    Palette(pc),a1
  68.     moveq    #$000000,d2
  69.     moveq    #00,d3
  70.     move.l    #128,d4
  71. .Fade    move.l    d0,-(sp)    ;Run our own VBL wait code here
  72.     moveq    #$00,d0    ;for better fading.
  73.     CALL    WaitRastLine
  74.     CALL    AutoSwitch
  75.     move.l    (sp)+,d0
  76.     CALL    PaletteToColour
  77.     tst.w    d0
  78.     bne.s    .Fade
  79.     rts
  80.  
  81. ;===========================================================================;
  82. ;                               FLOOD FILL
  83. ;===========================================================================;
  84.  
  85. FloodFill:
  86.     move.l    Screen(pc),a0
  87.     lea    Rasterlist(pc),a2
  88.     cmp.w    #256,2(a2)
  89.     bge.s    .done
  90.     addq.w    #1,2(a2)
  91.     CALL    UpdateRasterLines
  92.     moveq    #$00,d0
  93.     rts
  94.  
  95. .done    moveq    #-1,d0
  96.     rts
  97.  
  98. ;===========================================================================;
  99. ;                                  DATA
  100. ;===========================================================================;
  101.  
  102. ScreenTags:
  103.     dc.l    TAGS_GAMESCREEN
  104. Screen:    dc.l    0
  105.     dc.l    GSA_Palette,Palette
  106.     dc.l    GSA_Rasterlist,Rasterlist
  107.     dc.l    GSA_ScrWidth,320
  108.     dc.l    GSA_ScrHeight,256
  109.     dc.l    GSA_Planes,7
  110.     dc.l    GSA_Attrib,BLKBDR|CENTRE
  111.     dc.l    GSA_ScrMode,HIRES|LACED
  112.     dc.l    GSA_ScrType,ILBM
  113.     dc.l    TAGEND
  114.  
  115. Palette    dc.l    $000000,$FFFFFF,$FAF5F2,$FAE8E7
  116.     dc.l    $EEDED5,$E8D4C8,$DDC0AF,$D7B5A2
  117.     dc.l    $D1AC96,$DCA491,$CBA38B,$C5997E
  118.     dc.l    $BD8E74,$B5846A,$AD7A5F,$A57056
  119.     dc.l    $9D674D,$955D44,$8C533B,$844B34
  120.     dc.l    $7C432D,$743B26,$6C3320,$642D1B
  121.     dc.l    $5C2616,$532010,$4A1D0C,$411A09
  122.     dc.l    $381606,$2F1204,$260F02,$1D0C00
  123.     dc.l    $AC783A,$A67139,$A06C39,$986638
  124.     dc.l    $995F36,$906037,$8C5C36,$945733
  125.     dc.l    $865735,$905030,$7E5133,$8D4B2E
  126.     dc.l    $764B31,$6E4630,$8A462D,$64412B
  127.     dc.l    $5D3D27,$593A24,$543822,$50351F
  128.     dc.l    $4B341D,$47301A,$592218,$402D17
  129.     dc.l    $382813,$3B2007,$302310,$2B200D
  130.     dc.l    $331100,$430907,$3C0504,$2E0202
  131.     dc.l    $B48038,$B7743D,$AE6350,$A85D4A
  132.     dc.l    $A35644,$9E503E,$994A39,$944534
  133.     dc.l    $9F4336,$8E3F30,$87412B,$87382A
  134.     dc.l    $823628,$803226,$792C21,$72251C
  135.     dc.l    $E1AB98,$DBA28C,$D79C89,$D29582
  136.     dc.l    $CD8D7A,$C88672,$C27E6B,$BD7764
  137.     dc.l    $B8705D,$B36A57,$BB5244,$AD4A3D
  138.     dc.l    $C8594A,$7F7444,$847D49,$67271E
  139.     dc.l    $6C2219,$651D15,$5E1711,$57130E
  140.     dc.l    $500F0B,$4A0C09,$350303,$270000
  141.     dc.l    $89874E,$8C8E53,$8C9358,$8E9D62
  142.     dc.l    $C6904A,$9AA467,$CD9E51,$AFAE6F
  143.     dc.l    $E3D765,$D5AE58,$BCAD78,$C1AC7C
  144.     dc.l    $CBAA82,$D5A588,$EAA09B,$ECA7A2
  145.     dc.l    $EDADA9,$EFB5B1,$F0BBB8,$F2C2BF
  146.     dc.l    $F4CBC8,$F5D1CF,$F7D9D7,$FDF7F7
  147.  
  148. Rasterlist:
  149.     WAITLINE 000
  150.     FLOOD
  151.     RASTEND
  152.  
  153. PicFile    dc.b    "GMS:demos/data/Yattering128.pak",0
  154.     even
  155.  
  156.